#include("./layout/header.html")
#@layout()
#define content()
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="/static/images/logo.png"/>
            <cite>&nbsp;AIFast快速开发平台</cite>
        </div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <!--暂关闭消息模板 这个功能目前无用-->
            <li class="layui-nav-item layui-hide" lay-unselect>
                <a ew-event="message" title="消息">
                    <i class="layui-icon layui-icon-notice"></i>
                    <span id="messageElem" class="layui-badge-dot layui-hide"></span>
                </a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>
            </li>
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
            </li>
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="lockScreen" title="锁屏"><i class="layui-icon layui-icon-password"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a>
                    <img id="avatar" class="layui-nav-img">
                    <cite id="realName"></cite>
                </a>
                <dl class="layui-nav-child">
                    <dd lay-unselect><a ew-href="/view/template/user-info">个人中心</a></dd>
<!--                    <dd lay-unselect><a ew-event="psw">修改密码</a></dd>-->
                    <dd lay-unselect><a ew-event="updateAuth">刷新权限</a></dd>
                    <hr>
                    <dd lay-unselect><a id="logout">退出</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
            </li>
        </ul>
    </div>

    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul id="sideMenu" class="layui-nav layui-nav-tree arrow2" lay-filter="admin-side-nav" lay-shrink="_all">
                <!--<li class="layui-nav-item">
                    <a><i class="layui-icon layui-icon-home"></i>&emsp;<cite>Dashboard</cite></a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="console/workplace">工作台</a></dd>
                        <dd><a lay-href="console/console">控制台</a></dd>
                        <dd><a lay-href="console/dashboard">分析页</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a><i class="layui-icon layui-icon-set"></i>&emsp;<cite>系统管理</cite></a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="module/sys/user">用户管理</a></dd>
                        <dd><a lay-href="module/sys/role">角色管理</a></dd>
                        <dd><a lay-href="module/sys/authorities">权限管理</a></dd>
                        <dd><a lay-href="module/sys/dictionary">字典管理</a></dd>
                        <dd><a lay-href="module/sys/organization">机构管理</a></dd>
                        <dd><a lay-href="module/log/login-record">登录日志</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item">
                    <a lay-href="example/generator"><i class="layui-icon layui-icon-unlink"></i>&emsp;<cite>代码生成器3.0</cite></a>
                </li>-->
            </ul>
        </div>
    </div>



    <!-- 主体部分 -->
    <div class="layui-body"></div>
    <!-- 底部 -->
    <div class="layui-footer layui-text">
        copyright © 2021 <a href="#" target="_blank">aisinjuaro微码工作室</a> all rights reserved.
    </div>
</div>

<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>

<!-- js部分 -->
<script>
    layui.use(['index','admin','element','sse'], function () {
        var $ = layui.jquery;
        var index = layui.index;
        var admin = layui.admin;
        var element = layui.element;

        admin.req('/sys/sysUser/personal',{},function (d) {
            if(d.code === 0){
                $('#realName').html(d.data.realName)
                $('#avatar').attr('src',d.data.avatar)
                admin.req('/sys/sysAuthorities/getSideMenu',{},function (d) {
                    if(d.code === 0){
                        let html = '';
                        $('#sideMenu').html(html);
                        $.each(d.data,function (i,n) {
                            html = html + '<li class="layui-nav-item">\n' +
                                '        <a lay-href="'+n.url+'"><i class="layui-icon '+n.icon+'"></i>&emsp;<cite>'+n.name+'</cite></a>\n';
                            if(n.subMenus.length > 0){
                                html = html + '<dl class="layui-nav-child">';
                                $.each(n.subMenus,function (i1,n1){
                                    html = html + '<dd>\n' +
                                        '            <a lay-href="'+n1.url+'">'+n1.name+'</a>\n' +
                                        '        </dd>';
                                })
                                html = html + '</dl>';
                            }
                            html = html + '</li>';

                        })

                        $('#sideMenu').append(html);
                        element.render('nav');
                    }
                })
            }
        })

        // 默认加载主页
        index.loadHome({
            menuPath: '/view/console/workplace',
            menuName: '<i class="layui-icon layui-icon-home"></i>'
        });

        $('#logout').click(function () {
            admin.req('/login/out');
            admin.putTempData("tokenInfo",'');
        })


    });
</script>
</body>
#end
